<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8"/>
 <meta name="author" content="order by dede58.com"/>
 <title>登录</title>
 <meta name="author" content="DeathGhost" />
 <link rel="stylesheet" type="text/css" href="css/style.css" />
 <style>
  body{height:100%;background:#16a085;overflow:hidden;}
  canvas{z-index:-1;position:absolute;}
 </style>
 <script src="js/jquery-3.3.1.js"></script>
 <script src="js/verificationNumbers.js"></script>
 <script src="js/Particleground.js"></script>
 <script>
  $(document).ready(function() {
   //粒子背景特效
   $('body').particleground({
    dotColor: '#5cbdaa',
    lineColor: '#5cbdaa'
   });
  });
 </script>
</head>
<body>
<dl class="admin_login">
 <dt>
  <strong>捷流物流</strong>
  <em>etSystem</em>
 </dt>
 <dd class="user_icon">
   <input id="username" type="text" placeholder="用户名" class="login_txtbx">
 </dd>
 <dd class="pwd_icon">
   <input id="password" type="password" placeholder="密码" class="login_txtbx">

 </dd>
 <!--<dd class="val_icon">
  <div class="checkcode">
   <input type="text" id="J_codetext" placeholder="验证码" maxlength="4" class="login_txtbx">
   <canvas class="J_codeimg" id="myCanvas" onclick="createCode()">对不起，您的浏览器不支持canvas，请下载最新版浏览器!</canvas>
  </div>
  <input type="button" value="验证码核验" class="ver_btn" onClick="validate();">
 </dd>-->
 <dd>
  <input type="button" value="立即登录" class="submit_btn" onclick="login()"/>
 </dd>
 <dd>
  <p>© 2023-2024 李祖旺&卢灿富 版权所有</p>
  <p>桂B2-20080224-1</p>
 </dd>
</dl>
</body>
<script>
 //input标签这样获取值

 function login(){
  var name = $("#username").val();
  var password = $("#password").val();
  if(!name){
    alert("请输入用户名！");
    return;
  }
  if(!password){
   alert("请输入密码");
   return ;
  }
   $.ajax({
    url: "/admin/getAdmin",
    data: {name: name, password: password},
    type: "GET",//请求方式
    contentType: "application/json",//返回数据类型
    success: function (data) {
     console.log(data);
     if (data.code == "1") {
      alert("登录成功");
      location.href = "/main.jsp"; //进入主页
     } else {
      alert("用户名或密码错误，请重新输入")
      //location.href = "/login.html";
     }
    }
   })
 }
</script>
</html>
